package com.fenghongzhang.day005test2.presenter;

import android.util.Log;

import com.fenghongzhang.day005test2.contract.UserContract;
import com.fenghongzhang.day005test2.entity.User;
import com.fenghongzhang.mvp_lib.presenter.BasePresenter;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

public class UserPresenter extends BasePresenter<UserContract.IUserModel,UserContract.IUserView> {

    private static final String TAG = "UserPresenter";

    public UserPresenter(UserContract.IUserModel mModel, UserContract.IUserView mView) {
        super(mModel, mView);
    }

    public void registerUser(){
        mModel.register(mView.getName(), mView.getPwd(), new Observer<User>() {
            @Override
            public void onSubscribe(Disposable d) {

            }

            @Override
            public void onNext(User user) {
                Log.i(TAG, "onNext: "+user);
                mView.ShowMsg(user);

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onComplete() {

            }
        });
    }

}
